using Mvc.Mailer;
using System.Collections;
using System.Collections.Generic;
using WebCalendar.Models;

namespace WebCalendar.Mailers
{ 
    public class UserMailer : MailerBase, IUserMailer 	
	{
		public UserMailer()
		{
			MasterName="_Layout";
		}
		
		public virtual MvcMailMessage Welcome(MailData mailData)
		{
			//ViewBag.Data = someObject;
			return Populate(x =>
			{
				x.Subject = mailData.Subject;
				x.ViewName = mailData.ViewName;
				x.To.Add(mailData.Addressee);
			});
		}

        public virtual MvcMailMessage PasswordReset(MailData mailData)
		{
            
			//ViewBag.Data = someObject;
			return Populate(x =>
			{
				x.Subject = "PasswordReset";
				x.ViewName = "PasswordReset";
				x.To.Add("some-email@example.com");
			});
		}
        public virtual MvcMailMessage NewAppointmentRequest(NewAppointmentRequestData data)
        {

            ViewBag.Data = data;

            return Populate(x =>
            {
                x.Subject = data.Subject;
                x.ViewName = data.ViewName;
                x.To.Add(data.Addressee);
            });
        }

        public virtual MvcMailMessage RefusedAppointmentRequest(RefusedAppointmentRequestData data)
        {

            ViewBag.Data = data;

            return Populate(x =>
            {
                x.Subject = data.Subject;
                x.ViewName = data.ViewName;
                x.To.Add(data.Addressee);
            });
        }
        public virtual MvcMailMessage AcceptedAppointmentRequest(AcceptedAppointmentRequestData data)
        {

            ViewBag.Data = data;

            return Populate(x =>
            {
                x.Subject = data.Subject;
                x.ViewName = data.ViewName;
                x.To.Add(data.Addressee);
            });
        }

 	}


    public class MailData
    {
        public string Addressee { get; set; }
        public string Subject { get; set; }
        public string ViewName { get; set; }
    }
    public class NewAppointmentRequestData : MailData
    {
        public AppointmentRequest Appointment { get; set; }
        public UserProfile AdresseeUser { get; set; }
    }
    public class RefusedAppointmentRequestData : MailData
    {
        public AppointmentRequest Appointment { get; set; }
        public string CalendarOwnerName { get; set; }
    }
    public class AcceptedAppointmentRequestData : MailData
    {
        public AppointmentRequest Appointment { get; set; }
        public string CalendarOwnerName { get; set; }
    }

}